package com.ycp.erp.employee.ui.activity;

import android.annotation.SuppressLint;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.jakewharton.rxbinding2.view.RxView;
import com.one.common.config.RouterPath;
import com.one.common.manager.RouterManager;
import com.one.common.manager.event.Subscribe;
import com.one.common.view.base.BaseActivity;
import com.one.common.view.widget.ClearEditView;
import com.one.common.view.widget.MyTitleBar;
import com.ycp.erp.R;
import com.ycp.erp.role.model.event.RoleEvent;

import java.util.concurrent.TimeUnit;

import butterknife.BindView;

/**
 * Class Des:新增员工
 * Created by bjh on 2021/9/16.
 */
@Route(path = RouterPath.ADD_EMPLOYEE)
public class AddEmployeeActivity extends BaseActivity {
    @BindView(R.id.ceUserName)
    ClearEditView ceUserName;
    @BindView(R.id.ceName)
    ClearEditView ceName;
    @BindView(R.id.cePsw)
    ClearEditView cePsw;
    @BindView(R.id.ceEmail)
    ClearEditView ceEmail;
    @BindView(R.id.cePhone)
    ClearEditView cePhone;
    @BindView(R.id.tvSex)
    TextView tvSex;
    @BindView(R.id.rlSex)
    RelativeLayout rlSex;
    @BindView(R.id.tvRole)
    TextView tvRole;
    @BindView(R.id.rlRole)
    RelativeLayout rlRole;
    @BindView(R.id.llTop)
    LinearLayout llTop;
    @BindView(R.id.tvAddRemarks)
    TextView tvAddRemarks;
    @BindView(R.id.tvRemarks)
    TextView tvRemarks;
    @BindView(R.id.llRemark)
    LinearLayout llRemark;
    @BindView(R.id.llHint)
    LinearLayout llHint;
    @BindView(R.id.tvSubmit)
    TextView tvSubmit;

    @Override
    protected void initPresenter() {

    }

    @Override
    protected void initTitle() {
        super.initTitle();
        getMyTitleBar().setMode(MyTitleBar.Mode.BACK_TITLE)
                .setTitleText("新增员工").hideLine();
    }

    @SuppressLint("CheckResult")
    @Override
    public void initView() {
        super.initView();
        RxView.clicks(rlRole).throttleFirst(500, TimeUnit.MILLISECONDS).subscribe(o->{
            RouterManager.getInstance().go(RouterPath.SELECT_ROLE);
        });
    }

    @Subscribe
    public void onEvent(RoleEvent event){
      if (event!=null){
          tvRole.setText(event.getRole().getName());
      }
    }
    @Override
    public int getLayoutResId() {
        return R.layout.activity_add_employee;
    }
}
